#include<bits/stdc++.h>
#define ll long long
#define L x<<1
#define R L|1
#define mid (l+r>>1)
#define lc L,l,mid
#define rc R,mid+1,r
#define OK Ll<=l&&r<=Rr
#define Root 1,1,n
#define rep(x,y,z) for(int x=(y);x<=(z);x++)
#define per(x,y,z) for(int x=(y);x>=(z);x--)
#define repn(x) rep(x,1,n)
#define repm(x) rep(x,1,m)
#define pb push_back
#define e(x) for(int i=h[x],y=to[i];i;i=nxt[i],y=to[i])
#define E(x) for(auto y:p[x])
#define Pi pair<ll,ll>
#define ui unsigned ll
inline int read(){int s=0,w=1;char c=getchar();while(c<48||c>57) {if(c=='-') w=-1;c=getchar();}while(c>=48&&c<=57)s=(s<<1)+(s<<3)+c-48,c=getchar();return s*w;}
inline void pf(int x){if(x<0) putchar('-'),x=-x;if(x>9)pf(x/10);putchar(x%10+48);}
using namespace std;
const int N=5e5+5,M=1.1e6+5,inf=(1LL<<31)-1,mod=998244353;
const ll llf=1e18;
inline void add(int &a,int b){((a+=b)>=mod) and (a-=mod);}
inline int Add(int a,int b){return add(a,b),a;}
inline int mul(int a,int b){return 1LL*a*b%mod;}
inline void Mul(int &a,int b){a=mul(a,b);}
inline void red(int &a,int b){add(a,mod-b);}
inline int Red(int a,int b){return red(a,b),a;}
inline int qp(int a,int b){if(!b)return 1;int c=qp(a,b>>1);Mul(c,c);if(b&1)Mul(c,a);return c;}
inline int INV(int x){return qp(x,mod-2);}
int m,a[N],b[N],c[N],d[N],ps[N],n,ty[N];
struct num{
	int a,b;
}f[N],g[N];
inline bool cmp(num a,num b){
    ll l=1LL*a.a*a.b,r=1LL*b.a*b.b;
    if(l>0)l=1;else if(l<0)l=-1;
    if(r>0)r=1;else if(r<0)r=-1;
    if(l>r)return 0;
    if(l<r)return 1;
    if(l==0&&r==0)return 0;
	if(l==1&&r==1)return 1LL*abs(a.a)*abs(b.b)<1LL*abs(b.a)*abs(a.b);
    return 1LL*abs(a.a)*abs(b.b)>1LL*abs(b.a)*abs(a.b);
}
inline bool eql(num a,num b){
    ll l=1LL*a.a*a.b,r=1LL*b.a*b.b;
    if(l>0)l=1;else if(l<0)l=-1;
    if(r>0)r=1;else if(r<0)r=-1;
    if(l>r)return 0;
    if(l<r)return 0;
    if(l==0&&r==0)return 1;
	return a.a*b.b==b.a*a.b;
}
ll t[N][2];
inline void ad(int x,ll k,bool ty){
    while(x<=n)t[x][ty]+=k,x+=x&-x;
}
inline ll que(int x,int ty){
    ll ans=0;
    while(x)ans+=t[x][ty],x-=x&-x;
    return ans;
}
int ln;
inline int find(num x){
    int l=1,r=n;
    while(l<=r){
        if(eql(g[mid],x))return mid;
        if(cmp(g[mid],x))l=mid+1;
        else r=mid-1;
    }
    return l;
}
ll xd[N<<2];
inline void modify(int x,int l,int r,int p,ll k){
    xd[x]+=k;
    if(l==r)return;
    p<=mid?modify(lc,p,k):modify(rc,p,k);
}
inline int query(int x,int l,int r,ll nd){
    if(l==r)return l;
    if(xd[L]>=nd)return query(lc,nd);
    return query(rc,nd-xd[L]);
}
inline int getid(int x){
    return find({d[x],b[x]});
}
inline void suball(){
    ln=0;
    repn(i)if(b[ps[i]])f[++ln]={d[ps[i]],b[ps[i]]};
    n=ln,ln=0;
    sort(f+1,f+n+1,cmp);
    if(!n){
        repm(i)puts("0");
		return;
    }
    g[++ln]=f[1];
    rep(i,2,n)if(!eql(f[i-1],f[i]))g[++ln]=f[i];
    n=ln;
    ll Ex=0;
    repm(i){
        if(ty[i]==1){
            if(!b[i])Ex+=abs(c[i]);
            else {
            int id=getid(i);
            modify(Root,id,abs(b[i]));
            ll wb=abs(d[i]),wk=abs(b[i]);
            ad(id,wk*2LL,0),ad(1,-wk,0);
            if(1LL*b[i]*d[i]>=0)ad(1,wb,1),ad(id,-wb*2LL,1);
            else ad(1,-wb,1),ad(id,wb*2LL,1);
            }
        }else {
            if(!b[ps[a[i]]])Ex+=abs(c[ps[a[i]]]);
            else {
            int id=getid(ps[a[i]]);
            modify(Root,id,-abs(b[ps[a[i]]]));
            ll wb=abs(d[ps[a[i]]]),wk=abs(b[ps[a[i]]]);
            ad(id,-wk*2LL,0),ad(1,wk,0);
            if(1LL*b[ps[a[i]]]*d[ps[a[i]]]>=0)ad(1,-wb,1),ad(id,wb*2LL,1);
            else ad(1,wb,1),ad(id,-wb*2LL,1);
            }
        }
        double ans=0;
        if(xd[1]){
            int ps=query(Root,(xd[1]+1)/2);
            ll W1=que(ps,0),W2=que(ps,1);
            double k=(double)g[ps].a/(double)g[ps].b;
            ans=(double)k*(double)W1+(double)W2;
        }
        printf("%.6lf\n",ans+(double)Ex);
    }
}
inline void Main(){
	m=read();
	repm(i){
		int op=read();ty[i]=op;
		if(op==1)a[i]=read(),b[i]=read(),c[i]=read(),d[i]=a[i]*b[i]+c[i],ps[++n]=i;
		else a[i]=read();
	}
    return suball(),void();
}
signed main(){
	freopen("love.in","r",stdin);
	freopen("love.out","w",stdout);
	int T=1;
	while(T--)Main();
	return 0;
}